home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 …ember: Reference Library / Dev.CD Dec 96 RL / Dev.CD Dec 96 RL.toast / What's New? / Development Kits / Installer SDK Cornucopia 1.0 / Script Examples / ResMerge [inrm] Example / myResMerge.r < prev    next >
Encoding:
Text File  |  1996-09-23  |  6.0 KB  |  191 lines  |  [TEXT/MPS ]

  1. //
  2. //    "myResMerge.r"
  3. //
  4. //        This Installer script source demonstrates use of ResMerge atoms.
  5. //        ResMerge atoms copy all the resources from the source file to
  6. //        the target file without the need for specifying any of the
  7. //        individual resource items. This atom type's main value is as
  8. //        a time saving device when writing installer scripts.
  9. //
  10. //        IMPORTANT SAFETY TIP : Both Custom Install options in this example 
  11. //        install several 'vers' resource items to the target file. These 
  12. //        "extra" version resources are basically harmless, but the first 
  13. //        option will install those resources to your active system file. 
  14. //        This is a weird ( but harmless ) thing to do and is intended only 
  15. //        as an example of how to add resource items to the active System file
  16. //        using ResMerge atoms.
  17. //        
  18. //        Three important things to remember about ResMerge atoms:
  19. //        1) They are always executed before resource atoms ( 'inra' )
  20. //            when the items they reference are contained on the same
  21. //            install disk.
  22. //        2) ResMerge atoms are not supported with InstaCompOne compression
  23. //            at this time ( 4.0.3 ).
  24. //        3) ResMerge atoms always overwrite the resource items in the
  25. //            target file.
  26. //
  27. //        NOTE: This example uses pre-4.0 method for creating Custom Install
  28. //        options. It is not intended as an example of how to use 4.0 User 
  29. //        Interface features. For more information on how to create the
  30. //        Easy and Custom Install options, etc. try the "Custom UI" example.
  31. //
  32. //
  33. //        Copyright 1993-1996, Apple Computer, Inc., All Rights Reserved
  34. //
  35.  
  36. #include "InstallerTypes.r"
  37.  
  38.  
  39. // • packages
  40.  
  41. resource 'inpk' (100) {
  42.     format0 {
  43.         showsOnCustom,
  44.         removable,
  45.         forceRestart,                        // always force restart when modifying system files
  46.         0,
  47.         0,
  48.         "ResMerge atom to active System file on target volume.",
  49.         {    
  50.         'inrm', 1000;
  51.         },
  52.     }
  53. };
  54.  
  55. resource 'inpk' (200) {
  56.     format0 {
  57.         showsOnCustom,
  58.         removable,
  59.         dontForceRestart,                    // no need to reboot in this case
  60.         0,
  61.         0,
  62.         "ResMerge atom to SimpleText on root of target volume.",
  63.         {    
  64.         'inrm', 2000;
  65.         },
  66.     }
  67. };
  68.  
  69.  
  70. // • ResMerge atoms
  71.  
  72. //     NOTE: For sake of simplicity both of the resource merge atoms
  73. //    defined below use the same source file to store the resource
  74. //    items to be installed. A more common usage of the resMerge atom 
  75. //    ( 'inrm' ) is to have unique source files ( containing different 
  76. //    resource items ) for each resMerge atom. To do this, just define 
  77. //    a unique source spec ( 'infs' ) for each resMerge atom and specify 
  78. //    the ID for the source spec for each resMerge atom.
  79.  
  80. // ResMerge atom for source >> active System file
  81. resource 'inrm' (1000) {
  82.     format0 {
  83.         0,
  84.         10001,        // target spec for active System file
  85.         10000,         // shared source spec for ResMerge atom
  86.         ""
  87.     }
  88. };
  89.  
  90. // ResMerge atom for source >> SimpleText on root folder of target volume
  91. resource 'inrm' (2000) {
  92.     format0 {
  93.         0,
  94.         20001,        // target spec for SimpleText on root folder of target volume
  95.         10000,         // shared source spec for ResMerge atom
  96.         ""
  97.     }
  98. };
  99.  
  100.  
  101. // • file specs
  102.  
  103. // target file spec for active System file on target volume
  104. resource 'intf' (10001) {
  105.     format1 {
  106.         noSearchForFile,                 // use default search path
  107.         
  108.         TypeCrMustMatch,                 // If this is set to TypeCrMustMatch
  109.                                         // then a file with a different type
  110.                                         // and creator than those specified
  111.                                         // below will not be updated.
  112.                                         // If this is set to TypeCrNeedNotMatch
  113.                                         // then type and creator of an existing
  114.                                         // target file are ignored.
  115.         
  116.         // The Type and Creator fields will be used to set the
  117.         // file's Type and Creator when a new file is created. 
  118.         // NOTE: It's never a good idea to create a bogus
  119.         // System file with just a couple of resources. A better
  120.         // way to handle installation to a System file is to use
  121.         // a resource atom ('inra'), because it allows you to
  122.         // require the target file to exist before installing
  123.         // any resource items to the target file.
  124.         'zsys',                         // TYPE for new file
  125.         'MACS',                         // CREATOR for new file
  126.         
  127.         0,                                 // finder attribute flags
  128.                                         // filled by ScriptCheck is value is 0
  129.         
  130.         1,                                  // creation date for new file
  131.         1,                                  // modification date for new file
  132.                                         // NOTE: DATE values are filled
  133.                                         // by ScriptCheck if the value is 1
  134.                                             
  135.         0,                                 // search proc ID ( 'insp' ), none used
  136.         
  137.         "special-macs:System"            // path to target file
  138.         }
  139.     };
  140.  
  141. // target file spec for SimpleText application on root of target volume
  142. // NOTE: When a target spec is called from within a resource atom of
  143. // any kind ( 'inra', 'inrm', 'inr#' ), the type, creator, dates and
  144. // Finder attributes fields will only apply when creating a new file.
  145. resource 'intf' (20001) {
  146.     format1 {
  147.         noSearchForFile,                 // use default search path
  148.         
  149.         TypeCrMustMatch,                 // If this is set to TypeCrMustMatch
  150.                                         // then a file with a different type
  151.                                         // and creator than those specified
  152.                                         // below will not be updated.
  153.                                         // If this is set to TypeCrNeedNotMatch
  154.                                         // then type and creator of an existing
  155.                                         // target file are ignored.
  156.         
  157.         // The Type and Creator fields will be used to set the
  158.         // file's Type and Creator when a new file is created. 
  159.         'APPL',                         // TYPE for new file
  160.         'ttxt',                         // CREATOR for new file
  161.         
  162.         0,                                 // finder attribute flags
  163.                                         // filled by ScriptCheck is value is 0
  164.         
  165.         1,                                  // creation date for new file
  166.         1,                                  // modification date for new file
  167.                                         // NOTE: DATE values are filled
  168.                                         // by ScriptCheck if the value is 1
  169.                                             
  170.         0,                                 // search proc ID ( 'insp' ), none used
  171.         
  172.         ":SimpleText"                    // path to target file
  173.         }
  174.     };
  175.  
  176. // shared source file spec for ResMerge source file
  177. resource 'infs' (10000) {
  178.     'rsrc',                        // TYPE for source file
  179.     'RSED',                        // CREATOR for source file
  180.     
  181.     0x1,                        // creation DATE for source file
  182.     
  183.                                 // - ScriptCheck will fill in date
  184.                                 // fields that have a value of 0x1
  185.                                 
  186.     noSearchForFile,            // IGNORED in Installer 4.0.x
  187.     TypeCrMustMatch,            // TYPE, CREATOR must match file on install disk
  188.     "Disk 1:ResMergeSource.rsrc"    // path to target file
  189. };
  190.  
  191.